import { LevelHolder } from "../ability.js";
import Member from "./member.js";




export default class FightStatusM extends Member {
	host: LevelHolder;

	constructor(host: LevelHolder) {
		super(host);
	}

	/**目前生命值与最大生命值的比值 */
	hpRatio = 1;

	/**生命值上限 */
	get maxHp(): number {
		return [5, 10, 15, 20, 30, 40, 50, 100, 200, 300, 500][this.host.level];
	}

	/**当前生命值 */
	get currentHp(): number {
		return Math.round(this.maxHp * this.hpRatio);
	}
	set currentHp(value: number) {
		this.hpRatio = value / this.maxHp;
		if (this.hpRatio < 0) this.hpRatio = 0;
		if (this.hpRatio > 1) this.hpRatio = 1;
	}

	/**攻击力 */
	get attackPower(): number {
		return 2 * this.host.level + 1;
	}

	/**防御力 */
	get defensivePower() {
		return this.host.level;
	}

	/**敏捷度 */
	get agility(): number {
		return this.host.level + 10;
	}
}